//
//  ZCXPetPictureDetialTableViewCell.m
//  LoveOfPet
//
//  Created by dllo on 15/11/19.
//  Copyright © 2015年 孔维. All rights reserved.
//

#import "ZCXPetPictureDetialTableViewCell.h"
#import <SDWebImageManager.h>
#import <UIImageView+WebCache.h>
#define HEIGHT  [[UIScreen mainScreen]bounds].size.height / 667
#define WIDTH   [[UIScreen mainScreen]bounds].size.width / 375
@interface ZCXPetPictureDetialTableViewCell ()
@property (nonatomic, retain) UIImageView *imageV;
@property (nonatomic, retain) UILabel *userLabel;
@property (nonatomic, retain) UILabel *feelLabel;
@property (nonatomic, retain) UILabel *goodLabel;
@end

@implementation ZCXPetPictureDetialTableViewCell
- (void)dealloc{
    [_imageV release];
    [_userLabel release];
    [_feelLabel release];
    [_goodLabel release];
    [_pet release];
    [super dealloc];
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageV = [[UIImageView alloc]init];
        [self.contentView addSubview:_imageV];
        [_imageV release];
        
        self.userLabel = [[UILabel alloc]init];
        [self.contentView addSubview:_userLabel];
        [_userLabel release];
        
        self.feelLabel = [[UILabel alloc]init];
        [self.contentView addSubview:_feelLabel];
        [_feelLabel release];
        
        self.goodLabel = [[UILabel alloc]init];
        [self.contentView addSubview:_goodLabel];
        [_goodLabel release];
        
    }
    return self;
}
- (void)layoutSubviews{
    [super layoutSubviews];
    _imageV.frame = CGRectMake(10 * WIDTH, 5 * HEIGHT, 40 * WIDTH, 40 * HEIGHT);
    _userLabel.frame = CGRectMake(65 * WIDTH, 5 * HEIGHT, 200 * WIDTH, 20 * HEIGHT);
    _feelLabel.frame = CGRectMake(65 * WIDTH, 30 * HEIGHT, self.frame.size.width - 70 * WIDTH, 50 * HEIGHT);
}
- (void)setPet:(ZCXPetPictureDetialModel *)pet{
    if (_pet != pet) {
        [_pet release];
        _pet = [pet retain];
    }
    _imageV.layer.masksToBounds = YES;
    _imageV.layer.cornerRadius = 2 * WIDTH;
    [_imageV sd_setImageWithURL:[NSURL URLWithString:pet.user_profile_image_url]];
    _userLabel.font = [UIFont systemFontOfSize:15 * WIDTH];
    _feelLabel.font = [UIFont systemFontOfSize:13 * WIDTH];
    _feelLabel.textColor = [UIColor grayColor];
    _userLabel.text = pet.user_name;
    _feelLabel.text = pet.text;
    _feelLabel.numberOfLines = 0;
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
